import psutil
import platform
import time

while(True):
    cpu_percent = psutil.cpu_percent()
    memory_info = psutil.virtual_memory()
    net_io_counters = psutil.net_io_counters()
    memory_percent = memory_info.percent
    memory_total = memory_info.total /1024 /1024
    memory_available = memory_info.available /1024 /1024
    net_sent = net_io_counters.bytes_sent /1024 /1024
    net_recv = net_io_counters.bytes_recv /1024 /1024
    with open('./sys_status.txt', 'w') as file:
        print(f'{cpu_percent}&{memory_total}&{memory_percent}&{net_sent}&{net_recv}',
          file=file)
    time.sleep(0.5)
    